<template>
  <div class="search">
    <f-form ref="form" :action="api.airport" :form-key="this.formItem.airportId" >
      <f-form-item label=""  name="airportName" dataType="${formField.dataType}"   :value="formItem.airportName" />
      <f-form-item label="机场地址"  name="airportAddress" dataType="${formField.dataType}"   :value="formItem.airportAddress" />
      <f-form-item label="是否展示（1展示，2不展示）"  name="isShow" dataType="number"   :value="formItem.isShow" />
      <f-form-item label="机场图片"  name="airportImg" dataType="${formField.dataType}"   :value="formItem.airportImg" />
      <f-form-item label="机场电话"  name="airportPhone" dataType="${formField.dataType}"   :value="formItem.airportPhone" />
      <f-form-item label=""  name="managerPhone" dataType="${formField.dataType}"   :value="formItem.managerPhone" />
      <f-form-item label="机场经度"  name="cityCode" dataType="${formField.dataType}"   :value="formItem.cityCode" />
      <f-form-item label="区号"  name="areaCode" dataType="${formField.dataType}"   :value="formItem.areaCode" />
      <f-form-item label="机场排序"  name="airportSort" dataType="number"   :value="formItem.airportSort" />
      <f-form-item label=""  name="isHaveHekaRemark" dataType="number"   :value="formItem.isHaveHekaRemark" />
      <f-form-item label="是否需要电子签名"  name="isNeedSign" dataType="number"   :value="formItem.isNeedSign" />
      <f-form-item label="是否需要设置会员卡是否展示（0不展示,1展示）"  name="isNeedSetShow" dataType="number"   :value="formItem.isNeedSetShow" />
      <f-form-item label="是否需要设置黑名单"  name="isNeedSetBlack" dataType="number"   :value="formItem.isNeedSetBlack" />
      <f-form-item label="机场首字母"  name="letter" dataType="${formField.dataType}"   :value="formItem.letter" />
      <f-form-item label="机场3字码"  name="threeWord" dataType="${formField.dataType}"   :value="formItem.threeWord" />
      <f-form-item label="是否删除"  name="deleted" dataType="number"   :value="formItem.deleted" />
      <f-form-item label="更新人"  name="updateUser" dataType="${formField.dataType}"   :value="formItem.updateUser" />
      <f-form-item label="更新时间"  name="updateTime" dataType="${formField.dataType}"   :value="formItem.updateTime" />
      <f-form-item label="创建人"  name="createUser" dataType="${formField.dataType}"   :value="formItem.createUser" />
      <f-form-item label="创建时间"  name="createTime" dataType="${formField.dataType}"   :value="formItem.createTime" />
    </f-form>
  </div>
</template>
<script>
  import api from './js/api'
  export default {
    name: 'airportForm',
    props: {},
    data() {
      return {
        refs:this.$refs,
        api:  Object.assign(api, this.api),
        isAdd: true,//是否是添加模式
        loaded: false,//是否加载完成
        formItem: this.getFormItem()
      }
    },
    methods: {
      getFormItem() {
        return {
          airportId: '',
          airportName: '',
          airportAddress: '',
          isShow: '',
          airportImg: '',
          airportPhone: '',
          managerPhone: '',
          cityCode: '',
          areaCode: '',
          airportSort: '',
          isHaveHekaRemark: '',
          isNeedSign: '',
          isNeedSetShow: '',
          isNeedSetBlack: '',
          letter: '',
          threeWord: '',
          deleted: '',
          updateUser: '',
          updateTime: '',
          createUser: '',
          createTime: ''
        }
      },
      //表单赋值
      setData(data) {
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        if (data && data.airportId) {
          let params={
              airportId:data.airportId
          }
          this.refs['form'].getDetails(params,(data)=>{
             this.formItem=data
             this.loaded = true
          })
          this.isAdd = false
        } else {
          this.loaded = true
        }
      },
      //提交表单
      handleSubmit(callback) {
        this.$refs.form.submit({  }, callback)
      }
    },
    created() {
    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
